import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
	history: createWebHistory(import.meta.env.BASE_URL),
	routes: [
		{path: '/', redirect: '/manage/home'},
		{
			path: '/manage', name: 'manage', meta: {title: '管理'}, component: () => import('@/views/Manage.vue'),
			children: [
				{path: 'home', name: 'home', meta: {title: '主页'}, component: () => import('@/views/Home.vue')},
				{path: 'login', name: 'login', meta: {title: '登录'}, component: () => import('@/views/Login.vue')},
			]
		},
		{path:'/404',name: '404',meta: {title: '404'},component: () => import('@/views/404.vue')},
		// {path: '/:pathMatch(.*)*', name: 'notFound', redirect: '/404'}
	],
})

router.beforeEach((to, from,next) => {
	document.title = to.meta.title
	next()

})
export default router
